/**
 * 
 */
package com.rosense.srpingboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.rosense.srpingboot.cache.WebContextUtil;
import com.rosense.srpingboot.entity.UserLog;
import com.rosense.srpingboot.service.IUserService;

/**
 * @author 李岩飞
 * @email eliyanfei@126.com
 * @date 2018年3月10日 下午4:31:59
 */
@Controller
@RequestMapping(value = "base")
public class BaseController {
	@Autowired
    private IUserService userService;
	
	  /**
     * 记录用户日志
     */
    protected void addLog(String type) {
        try {
            //保存用户的设备信息
            UserLog log = new UserLog();
            log.setType(type);
            log.setAccount(WebContextUtil.getCurrentUser().getUser().getAccount());
            userService.saveLog(log);
        } catch (Exception e) {
        	e.printStackTrace();
        } 
    }
}
